<%--
/* ***** BEGIN LICENSE BLOCK *****
 * Version: MPL 1.1
 *
 * The contents of this file are subject to the Mozilla Public License Version
 * 1.1 (the "License"); you may not use this file except in compliance with
 * the License. You may obtain a copy of the License at
 * http://www.mozilla.org/MPL/
 *
 * Software distributed under the License is distributed on an "AS IS" basis,
 * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
 * for the specific language governing rights and limitations under the
 * License.
 *
 * The Original Code is the StikiWeb Wiki 
 *
 * The Initial Developer of the Original Code is Lee Haslup (biglee@haslups.com).
 * Portions created by the Initial Developer are Copyright (C) 2004
 * the Initial Developer. All Rights Reserved.
 *
 * Contributor(s):
 *
 * ***** END LICENSE BLOCK ***** */
 * $Id: adminPage.jsp,v 1.5 2004/05/07 15:05:46 biglee Exp $
--%> 
<%@ page language="java" contentType="text/html" %>
<%@ taglib uri="/WEB-INF/struts-bean.tld" prefix="bean" %>
<%@ taglib uri="/WEB-INF/struts-html.tld" prefix="html" %>
<%@ taglib uri="/WEB-INF/struts-logic.tld" prefix="logic" %>
<%@ taglib uri="/WEB-INF/struts-nested.tld" prefix="nested" %>
	<html>
  <head>
  	<link rel='icon' href='images/logo1.png' type='image/png' />
  	<link rel='shortcut icon' href='images/logo1.png' type='image/png' />
    <title>
      Stiki Wiki Admin: 
      <bean:write name="admin" property = "name" />
      <logic:empty name="admin" property="name" >
		(Wiki Base)
	  </logic:empty>
    </title>
  </head>
<body>
	<table width='100%'>
		<tr>
			<td width='10%'>
				<img src="images/logomed.png" alt="Stiki Wiki" />
			</td>
			<td>
				<h1>
					Stiki Wiki Admin: <bean:write name="admin" property = "name" />
					<logic:empty name="admin" property="name" >
						(Wiki Base)
					</logic:empty>
					<logic:notEmpty name="admin" property="newRecord">
						- NEW Admin Record.
					</logic:notEmpty>
				</h1>
			</td>
		</tr>
		<tr>
			<td valign='top' align='center'>
				&nbsp;
			</td>
			<td>
				<nested:form action='/adminPage.do' >
					<nested:hidden property='name' />
					<table width="100%" bgcolor="gray" cellpadding="7">
						<tr>
							<td colspan="3" bgcolor="lightblue">
								<b>Access Control</b>
							</td>
						</tr>
						<tr>
							<th width="25%" bgcolor="white">
								User Name
							</th>
							<th width="25%" bgcolor="white">
								Access Level
							</th>
							<th width="50%" bgcolor="white">
								Notes:
							</th>
						</tr>
						<nested:iterate property="users" >
							<tr>
								<td width="25%" bgcolor="white">
									<nested:write property="user"/>
									<nested:hidden property="user"/>
								</td>
								<td width="25%" bgcolor="white">
									<b><nested:write property="perm"/></b><br />
									<nested:equal value="ADMIN*" property="perm">
										<nested:hidden property="perm"/>
									</nested:equal>
									<nested:notEqual value="ADMIN*" property="perm">
										<font color="blue" size="-1"><i>change to:</i></font><br />
										<nested:select  property="perm">
											<html:option value="REMOVE">-remove from list-</html:option>
											<html:option value="NO_ACCESS">NO_ACCESS</html:option>
											<html:option value="READ">READ</html:option>
											<html:option value="COMMENT">COMMENT</html:option>
											<html:option value="AUDIT">AUDIT</html:option>
											<html:option value="ATTACH">ATTACH</html:option>
											<html:option value="EDIT">EDIT</html:option>
											<html:option value="EXTEND">EXTEND</html:option>
											<html:option value="ADMIN">ADMIN</html:option>
										</nested:select>
									</nested:notEqual>
								</td>
								<td width="50%" bgcolor="white">
									<nested:equal  value="default" property="user">
										Entries for user <i>default</i> apply to any user not specifically mentioned
										elsewhere in this list.
									</nested:equal>
									<nested:equal  value="Guest" property="user">
										Entries for user <i>Guest</i> apply to any user using the Guest login.
									</nested:equal>
									<nested:equal  value="Visitor" property="user">
										Entries for user <i>Visitor</i> apply to any user who has not logged it.
									</nested:equal>
									<nested:equal  value="Guest" property="user">
										Permissions granted to <i>Guest</i>s are available to any web user.
									</nested:equal>
									<nested:equal  value="Visitor" property="user">
										Permissions granted to <i>Visitor</i>s are available to any web user.
									</nested:equal>
									<nested:equal  value="NO_ACCESS" property="perm">
										NO_ACCESS -- user cannot access page or children.
									</nested:equal>
									<nested:equal  value="READ" property="perm">
										READ access - user can view the page but can't change it or see the markup.
									</nested:equal>
									<nested:equal  value="COMMENT" property="perm">
										COMMENT access - user can view the page and enter comments that are appended
										to the bottom of the page.
									</nested:equal>
									<nested:equal  value="AUDIT" property="perm">
										AUDIT access - user can view the page, leave comments and see 
										<i>but not change</i> its markup language.
									</nested:equal>
									<nested:equal  value="ATTACH" property="perm">
										EDIT access - user can view the page, leave comments and
										upload attachments, but cannot change page contents.
									</nested:equal>
									<nested:equal  value="EDIT" property="perm">
										EDIT access - user can view the page, leave comments,  
										upload attachments and change the page's content but can not create 
										child pages.
									</nested:equal>
									<nested:equal  value="EXTEND" property="perm">
										EXTEND access - user can view the page, leave comments,  
										upload attachments, change the page's content and create child pages.
									</nested:equal>
									<nested:equal  value="ADMIN" property="perm">
										ADMIN access - user can do anything with the page, its children
										and attachments (including access to this admin screen).
									</nested:equal>
									<nested:equal  value="ADMIN*" property="perm">
										ADMIN access - you cannot change your own ADMIN permission for a
										page but you can add another ADMIN user to the page and that user
										can access this screen and change your permission.  Alternatively,
										you can ask the administrator of the parent page to remove you.
									</nested:equal>
								</td>
							</tr>
						</nested:iterate>
						<tr>
							<td bgcolor="white">
								<font color="blue" size="-1"><i>add user to list</i></font><br />
								<nested:select property="newUserId" >
									<nested:optionsCollection property="availableUsers" label="user" value="user"/>
								</nested:select>
							</td>
							<td bgcolor="white">
								<font color="blue" size="-1"><i>new user's permission</i></font><br />
								<nested:select property="newUserPerm">
										<html:option value=""></html:option>
										<html:option value="NO_ACCESS">NO_ACCESS</html:option>
										<html:option value="READ">READ</html:option>
										<html:option value="COMMENT">COMMENT</html:option>
										<html:option value="AUDIT">AUDIT</html:option>
										<html:option value="ATTACH">ATTACH</html:option>
										<html:option value="EDIT">EDIT</html:option>
										<html:option value="EXTEND">EXTEND</html:option>
										<html:option value="ADMIN">ADMIN</html:option>
								</nested:select>
							</td>
							<td bgcolor="white">
								To add a user to the permission list select the user name and the permission
								level here.  To remove a user from the list change the user's 
								access level to "-remove from list-". 
							</td>
						</tr>
						<tr>
							<th bgcolor="white">
								&nbsp;
							</th>
							<td bgcolor="white">
								<nested:submit property="apply">apply</nested:submit>
							</td>
							<td bgcolor="white">
								Click "apply" to apply your changes locally to this list.  You will still need
							    to click <b>"
								<logic:notEmpty name="admin" property="newRecord">
									create new admin record
								</logic:notEmpty>
								<logic:empty name="admin" property="newRecord">
								  	save changes
								</logic:empty>
								"</b>(at the bottom of this page) to make your changes permanent.
							</td>
						</tr>
						<tr>
							<td colspan="3" bgcolor="lightblue">
								<b>Storage Management</b>
							</td>
						</tr>
						<tr>
							<th width="25%" bgcolor="white">
								Total Allocation:
							</th>
							<td width="25%" bgcolor="white">
								<nested:hidden property="maxStorage" />
								<nested:write property="maxStorage"/>(00) k
							</td>
							<td width="50%" bgcolor="white">
								This is the maximum size for this page, its children and attachments.
								A value of zero indicates that this page is limited only by the storage 
								available on its parent page.  
							</td>
						</tr>
						<tr>
							<th bgcolor="white">
								Storage Reserved:
							</th>
							<td bgcolor="white">
								<nested:empty property="reservedStorage">
									No
								</nested:empty>
								<nested:notEmpty property="reservedStorage">
									Yes
								</nested:notEmpty>
							</td>
							<td bgcolor="white">
								If set the maximum storage for this page is set aside and is guarenteed,
								even if parent and/or sibling pages are full.
							</td>
						</tr>
						<tr>
							<th bgcolor="white">
								Storage Used:
							</th>
							<td bgcolor="white">
								<nested:write property="storageUsed"/>
							</td>
							<td bgcolor="white">
								This is the number of bytes used by this page and its attachments plus 
								the storage used (or reserved) by any child page(s).
							</td>
						</tr>
						<tr>
							<th bgcolor="white">
								Available:
							</th>
							<td bgcolor="white">
								<nested:write property="availableStorage" />
							</td>
							<td bgcolor="white">
								This is the remaining space available (in bytes) for this page, its attachments 
								and any child pages that do not reserve storage.  The maximum storage
								for children that reserve space has already been deducted from this
								total. 
							</td>
						</tr>
						<tr>
							<th bgcolor="white">
								Max Attachment Size:
							</th>
							<td bgcolor="white">
								<nested:text property="maxSizePerAttachment" size="6" maxlength="6"/>(00) k
							</td>
							<td bgcolor="white">
								The maximum size of a single attachment to this (or a child) page in hundreds of k. 
								A value of zero does not allow any attachments to be uploaded.  Leave blank to
								use attachment size from parent page.
							</td>
						</tr>
						<tr>
							<td colspan="3" bgcolor="lightblue">
								<b>Template</b>
							</td>
						</tr>
						<tr>
							<th bgcolor="white">
								Page Template:
							</th>
							<td bgcolor="white">
								<nested:text property="templateName" size="20" maxlength="80"/>
							</td>
							<td bgcolor="white">
								The name of the wiki page to use as a 'template' for this page and its children.
								 Leave blank to use same template as parent page.  <i>Note:</i> the use of
								 page templates is a bit complicated.  It's best to leave this blank unless you
								 know what you are doing.
							</td>
						</tr>
						<tr>
							<td colspan="3" bgcolor="lightblue">
								<b>Hierarchy</b>
							</td>
						</tr>
						<nested:notEmpty property="adminParent">
							<tr>
								<th bgcolor="white">
									Parent Page
								</th>
								<td bgcolor="white">
									<nested:hidden property="adminParent" />
									<nested:equal property="adminParent" value="..">
										(Wiki Base)
									</nested:equal>
									<nested:notEqual property="adminParent" value="..">
										<nested:write property="adminParent" />
									</nested:notEqual>
								</td>
								<td bgcolor="white">
									The "parent page" is the page that provides the inherited permissions
									for this page and its children.  
									<nested:notEmpty property="canAdminParent">
										<nested:hidden property="canAdminParent" />
										<nested:equal property="canAdminParent" value="Yes">
											To save any changes to this page and go to the Admin screen for the
											parent page, push the "go to parent" button.
											<br /><nested:submit property="goToParent">
												go to parent
											</nested:submit>
										</nested:equal>
									</nested:notEmpty>
								</td>
							</tr>
						</nested:notEmpty>
						<nested:notEmpty property="hasAdminChildren">
						<tr>
							<th bgcolor="white">
								Administered<br />Child Pages
							</th>
							<td bgcolor="white" colspan="2">
								<nested:iterate id="child" property="adminChildren">
									<nested:hidden property="name" />
									<b><nested:write property="name" /></b>
									<input type='submit' name="goToChild" value='<nested:write property="name" />' label="go" />
									<br />&nbsp;<br />&nbsp;&nbsp;Storage:
									<nested:text property="maxStorage" size="6" maxlength="6" />(00)&nbsp;k
									&nbsp;Reserved 
									<nested:checkbox property="reservedStorage" value="On"/>
									&nbsp;Att Size:
									<nested:text property="maxSizePerAttachment" size="6" maxlength="6" />(00)&nbsp;k<br />&nbsp;<br />
								</nested:iterate>
							</td>
						</tr>
							</nested:notEmpty>
				</table>
					<nested:submit property="save">
						<logic:notEmpty name="admin" property="newRecord">
							create new admin record
						</logic:notEmpty>
						<logic:empty name="admin" property="newRecord">
						  	save changes
						</logic:empty>
					  </nested:submit>
					<nested:submit property="cancel">
						  cancel
					  </nested:submit>
				</nested:form>
			</td>
		</tr>
	</table>
</body>
</html>